home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 22 / Cream of the Crop 22.iso / program / eflibpt4.zip / DEMO / STREAMS / TEXTSTRM.PAS < prev   
Pascal/Delphi Source File  |  1996-08-11  |  947b  |  28 lines

  1. { Borland Pascal Extended Function Library - EFLIB (C) Johan Larsson, 1996
  2.   Demonstration; text files implemented as streams
  3.  
  4.   EFLIB IS PROTECTED BY THE COPYRIGHT LAW AND MAY NOT BE COPIED, SOLD OR
  5.   MANIPULATED. FOR MORE INFORMATION, SEE PROGRAM MANUAL! THIS DEMONSTRAT-
  6.   ION PROGRAM MAY FREELY BE USED AND DISTRIBUTED.                          }
  7.  
  8.  
  9. uses EFLIBIO;
  10.  
  11. const BufferSize  = 1000; { Buffer size for the data stream }
  12.  
  13. var TextFile : FileStreamObjectType; Text : string;
  14.  
  15.  
  16. begin
  17.      { Initialize buffered file stream }
  18.      TextFile.Initialize ('..\hamlet.txt', BufferSize);
  19.                           { Filename }     { Buffer size in bytes }
  20.  
  21.      while not TextFile.IsEnd do begin
  22.            { Read text line from the stream }
  23.            TextFile.ReadString (Text); { All text lines end with EOL }
  24.            WriteLn (Text); { Display line }
  25.       end;
  26.  
  27.       TextFile.Intercept; { Intercept stream }
  28. end.